from passlib.context import CryptContext
import random


def generate_random_string(n: int):
    return ''.join(random.choices('0123456789', k=n))

class Hashing(object):
    def __init__(self, schemes: str='bcrypt'):
        self.crypt = CryptContext(schemes=[schemes], deprecated="auto")

    def hash(self, raw_pwd: str) -> str:
        return self.crypt.hash(raw_pwd)

    def verify(self, raw_pwd: str, hashed_pwd: str) -> bool:
        return self.crypt.verify(raw_pwd, hashed_pwd)



